#include "ScnsSmctp.c.h"

#if defined(SCNS_SMCTP_ENABLE)&&SCNS_SMCTP_ENABLE==1

#include "ScnsMenu.h"
#include "ScnsMath.h"
#include "ScnsLed.h"

const ScnsSmctpChanelConfig scnsSmctpChanelConfig[SCNS_SMCTP_CHANNEL_MAX]={
    {.callback=scnsMenuReceiveInterrupt},/*SCNS_SMCTP_DEBUG*/
    {},/*SCNS_SMCTP_VISUAL_SCOPE*/
};

ScnsStatus scnsBspSmctpInit(void)
{
#if __SCNS_DEVICE_ID__==1
    uart_init(UART_1,57600,UART1_TX_A10,UART1_RX_A09);
#elif __SCNS_DEVICE_ID__==2
    uart_init(UART_1,57600,UART1_TX_A09,UART1_RX_A10);
#else
#error
#endif
    uart_tx_dma_init(UART_1);
    uart_rx_irq(UART_1,ENABLE);
    return SCNS_STATUS_OK;
}

ScnsStatus scnsBspSmctpPostInit(void)
{
    return SCNS_STATUS_OK;
}

ScnsStatus scnsBspSmctpCanSend(void)
{
    return SCNS_STATUS_OK;
}

int32 scnsBspSmctpSend(const uint8*buf,int32 len)
{
    scnsLedToggleAfter(SCNS_LED_D7,25*1000);
    uart_tx_dma_start(UART_1,buf,len);
    return len;
}

void scnsBspSmctpSendErrorCallback(void)
{
}

#endif